package com.enjoy.leetcode;

import java.util.Arrays;

/**
 * 两数之和
 */
public class ch1 {

    private static class Solution {
        public int[] twoSum(int[] nums, int target) {

            int s, e = 0;
            for (int i = 0; i < nums.length; i++) {
                for (int j = i + 1; j < nums.length; j++) {
                    if (nums[i] + nums[j] == target) {
                        s = i;
                        e = j;

                        return new int[]{s, e};
                    }

                }
            }

            return null;
        }

    }

    public static void main(String[] args) {
        Solution solution = new Solution();

        System.out.println("solution.twoSum(new int[]{1, 4, 8}, 9) = " + Arrays.toString(solution.twoSum(new int[]{1, 4, 8}, 9)));
    }
}


